﻿<%@ Control Language="C#" CodeFile="RadPagerEx.ascx.cs" Inherits="Shared_UserControl_RadPagerEx" %>
<telerik:RadCodeBlock ID="RadCodeBlock1NestedGrid" runat="server">
    <script type="text/javascript">
        Sys.Application.add_load(function () {
            var tableView = $find("<%# DataBinder.Eval(Container, "OwnerGridID") %>").get_masterTableView();
            var combo = $find("<%=ExRadComboBox1.ClientID %>"), num = $find("<%=ExRadNumericTextBox1.ClientID %>");
            if (combo)
            combo.add_selectedIndexChanged(function(s, e) {
                tableView.set_pageSize(s.get_value());
            });
            if (num)
            num.add_valueChanged(function(s, e) {
                tableView.page(s.get_value());
            });
        });
    </script>
</telerik:RadCodeBlock>
<table style="width: 100%;" cellspacing="0">
    <tr>
        <td class="rgPagerCell NextPrevNumericAndAdvanced">
            <div class="rgWrap rgArrPart1">
                <asp:Button ID="Button1" runat="server" Enabled='<%#(int)DataBinder.Eval(Container, "Paging.CurrentPageIndex")!=(int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") %>'
                    CommandName="Page" CommandArgument="First" Text=" " CssClass="rgPageFirst" ToolTip="转到第一页" />
                <asp:Button ID="Button2" runat="server" Enabled='<%#(int)DataBinder.Eval(Container, "Paging.CurrentPageIndex")!=(int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") %>'
                    CommandName="Page" CommandArgument="Prev" Text=" " CssClass="rgPagePrev" ToolTip="转到上一页" />
            </div>
            <div class="rgWrap rgArrPart2">
                <asp:Button ID="Button3" runat="server" Enabled='<%#(int)DataBinder.Eval(Container, "Paging.CurrentPageIndex")+1!=(int)DataBinder.Eval(Container, "Paging.PageCount") %>'
                    CommandName="Page" CommandArgument="Next" Text=" " CssClass="rgPageNext" ToolTip="转到下一页" />
                <asp:Button ID="Button4" runat="server" Enabled='<%#(int)DataBinder.Eval(Container, "Paging.CurrentPageIndex")+1!=(int)DataBinder.Eval(Container, "Paging.PageCount") %>'
                    CommandName="Page" CommandArgument="Last" Text=" " CssClass="rgPageLast" ToolTip="转到最后一页" />
            </div>
            <div class="rgWrap rgInfoPart">
                &nbsp;显示记录从 <strong>
                    <%# (int)DataBinder.Eval(Container, "Paging.FirstIndexInPage") + 1 %></strong>
                到 <strong>
                    <%# (int)DataBinder.Eval(Container, "Paging.LastIndexInPage") + 1%></strong>，总共<strong><%# DataBinder.Eval(Container, "Paging.DataSourceCount")%>条</strong>
            </div>
            <div class="rgWrap rgAdvPart">
                <span class="rgPagerLabel">当前:</span> <span style="white-space: nowrap;" class="RadInput">
                    <telerik:RadNumericTextBox ID="ExRadNumericTextBox1" Width="25px" Value='<%# (int)DataBinder.Eval(Container, "Paging.CurrentPageIndex") + 1 %>'
                        runat="server">
                        <NumberFormat DecimalDigits="0" />
                    </telerik:RadNumericTextBox></span> <span class="rgPagerLabel">/<%# DataBinder.Eval(Container, "Paging.PageCount")%>页</span>&nbsp;
                <span class="rgPagerLabel">每页:</span> <span style="white-space: nowrap;" class="RadInput">
                    <telerik:RadComboBox ID="ExRadComboBox1" DataSource='<%# GetPageSizes(DataBinder.Eval(Container, "Paging.PageSize")) %>'
                        Width="40" SelectedValue='<%# DataBinder.Eval(Container, "Paging.PageSize") %>'
                        runat="server" />
                    条 </span>
            </div>
        </td>
    </tr>
</table>